import request from '@/utils/service'

export default {
  // 获取
  async getMessage(data) {
    return await request({
      url: '/api/messages',
      method: 'get',
      params: data
    })
  },
  // 删除
  async deleteMessage(_id) {
    return await request({
      url: `/api/messages/${_id}`,
      method: 'delete'
    })
  },
  // 修改/新增
  async updataMessage(_id, data) {
    return await request({
      url: `/api/messages/${_id}`,
      method: 'put',
      data
    })
  },
  // 新增
  async addMessage(data) {
    return await request({
      url: '/api/messages',
      method: 'post',
      data
    })
  },
  // 获取一个
  async getOneMes(_id) {
    return await request({
      url: `/api/messages/${_id}`,
      method: 'get'
    })
  }

}
